package com.tnstart
{
	import com.tnstart.beans.ItemStatusBean;
	import com.tnstart.db.DBManager;
	import com.tnstart.utils.HashMap;
	
	import flash.events.EventDispatcher;

	
	[Event(name="homeUpdated", type="flash.events.Event")]
	
	public class DataSingleton extends EventDispatcher
	{
		private var _dbManager:DBManager;
		private var _dbLocation:String;
		private var _currectViewTitle:String = "";
		private var _currentSettingItemId:int = 0;
		private var _currentSettingAreaId:int = 0;
		private var _refreshAreaList:Boolean = false;
		
		private var _currectItemTypeId:int = 1;
		
		private var _itemStatusMap:HashMap = new HashMap();
		
		//1:byItemType  2:byArea
		private var _homeViewType:int = 1;
		
		private var _bgImage:String = "/assets/office/bg.png"; 
		
		public function DataSingleton()
		{
			super();	
		}
		
		public function getOrCreateItemStausByItemid(itemid:int):ItemStatusBean
		{
			var itemStatus:ItemStatusBean = _itemStatusMap.getValue(itemid);
			if(itemStatus == null)
			{
				itemStatus = new ItemStatusBean();
				itemStatus.itemid = itemid;
				_itemStatusMap.add(itemid, itemStatus);
			}
			
			return itemStatus;
		}

		public function get dbManager():DBManager
		{
			return _dbManager;
		}

		public function set dbManager(value:DBManager):void
		{
			_dbManager = value;
			
		}

		public function get dbLocation():String
		{
			return _dbLocation;
		}

		public function set dbLocation(value:String):void
		{
			_dbLocation = value;
		}

		public function get currectViewTitle():String
		{
			return _currectViewTitle;
		}

		public function set currectViewTitle(value:String):void
		{
			_currectViewTitle = value;
		}

		public function get currentSettingItemId():int
		{
			return _currentSettingItemId;
		}

		public function set currentSettingItemId(value:int):void
		{
			_currentSettingItemId = value;
		}

		public function get homeViewType():int
		{
			return _homeViewType;
		}

		public function set homeViewType(value:int):void
		{
			_homeViewType = value;
		}

		public function get itemStatusMap():HashMap
		{
			return _itemStatusMap;
		}

		public function set itemStatusMap(value:HashMap):void
		{
			_itemStatusMap = value;
		}

		public function get currentSettingAreaId():int
		{
			return _currentSettingAreaId;
		}

		public function set currentSettingAreaId(value:int):void
		{
			_currentSettingAreaId = value;
		}

		public function get refreshAreaList():Boolean
		{
			return _refreshAreaList;
		}

		public function set refreshAreaList(value:Boolean):void
		{
			_refreshAreaList = value;
		}

		public function get currectItemTypeId():int
		{
			return _currectItemTypeId;
		}

		public function set currectItemTypeId(value:int):void
		{
			_currectItemTypeId = value;
		}

		public function get bgImage():String
		{
			return _bgImage;
		}

		public function set bgImage(value:String):void
		{
			_bgImage = value;
		}

		

	}
}